﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Spring.Objects.Factory.Config;
//using Spring.Context;
//using Spring.Context.Support;
//using Infrastructure.Aspect.Spring;

//namespace Infrastructure.WpfClient.Spring
//{    
//    public class InjectionRequiredPostProcessor : IObjectPostProcessor
//    {        
//        public InjectionRequiredPostProcessor()
//        {            
//        }
//        #region IObjectPostProcessor Members
//        public object PostProcessAfterInitialization(object instance, string objectName)
//        {

//            IApplicationContext ctx = Infrastructure.Aspect.Patterns.SingletonInstance<IApplicationContext>.Instance;
            
//            var properties = instance.GetType().GetProperties();
//            foreach (var item in properties)
//            {
//                var ca = Attribute.GetCustomAttribute(item, typeof(InjectionRequired));
//                if (ca != null)
//                {                    
//                    var obj = ctx.GetObject(item.PropertyType.FullName);
//                    item.SetValue(instance, obj, null);
//                }
//            }
//            return instance;
//        }
//        public object PostProcessBeforeInitialization(object instance, string name)
//        {
//            return instance;
//        }
//        #endregion
//    }
//}
